1. Field of the Invention
The present invention relates to a method, system, and program for monitoring a device to determine whether the device has rebooted or gone through a new power cycle.
2. Description of the Related Art
Network printing systems generally comprise an assemblage of different printers, client computers, servers, and other components connected over a network. A network administrator or user may want to monitor the status of print jobs being printed or the general operational status of the printer. A computer may monitor a remote printer over a network using a network protocol, such as SNMP or TCP/IP, or a line connection such as a parallel port connection. Current printer software includes a print monitor component to monitor printer operations. For instance in the Microsoft Windows 95/98 systems, the user may display a queue of print jobs for the printer and a current status of the print jobs. The status usually indicates whether a particular queued job was sent to the printer and its status.
One print monitor protocol is the Line Printer Daemon (LPR) protocol, which is a component of the TCP/IP network protocol. LPR is used to communicate with printers across the network. LPR runs by executing a daemon on the host computer, which is then used to transmit commands, print jobs and other information to the printer and receive data and information from the printer. The LPR protocol allows a client application on one computer to send a print job to a print spooler service on another computer. The LPR daemon monitors a printer port to which it is assigned by xe2x80x9clisteningxe2x80x9d for messages from the client. The host computer would send a print command to the LPR daemon, which would then execute the command and communicate with the printer to cause the printer to follow the command. The LPR protocol includes a command to request the state of the printer, such as pages printer, queued jobs, etc. However, LPR is not capable of providing detailed error status information back to the client application.
Client computers may also communicate with network printers using the Simple Network Management Protocol (SNMP). A computer managing a printer may use the SNMP protocol to control the operation of the managed printer and determine job and print status for the printer. SNMP provides for a limited set of operations, including the get and set commands which, respectively, allow the managing computer to retrieve data and configure the printer. These commands may be used to monitor printer operations. Another SNMP command is the xe2x80x9ctrapxe2x80x9d command which causes the managed agent to send an event notification to the management system or printer manager identifying the occurrence of conditions such as threshold that exceeds a predetermined value. The managing computer registers a trap by writing information to the managed agent, which causes the managed agent to notify the registering computer of the event indicated in the registration.
SNMP is advantageous as a communication protocol because neither the agent nor manager rely on the other to continue operating. Thus, one may fail, and the other would carry on. SNMP further does not require the establishment of a communication path prior to the transmission of data. As a result, with SNMP, there is no guarantee that a transmission was received. Although most messages do transmit successfully, those that do not cannot be retransmitted. On the other hand, SNMP""s simplicity and connectionless communication also produce a degree of robustness. Neither the manager nor the agent relies on the other for its operation. Thus, a printer manager may continue to function even if the printer fails.
In certain cases, a power failure at a printer would erase all jobs that were pending in the printer. A printer monitor may find that the printer does not include any information on a print job previously sent. There may be many causes for the absence of a print job on the printer, including the occurrence of a power failure. For a printer monitor to provide fine grained monitoring of a device, the printer monitor would want to determine whether the absence of information is a result of a power failure. However, the lack of any information on a sent job at the printer after a power failure does not necessarily indicate that the job was lost as a result of power failure as the job may have completed printing or the job may not yet have been logged by the printer. There is thus a need in the art for providing a mechanism to determine whether the absence of information on a print job at the printer is a result of a power failure or some other event.
To overcome the limitations in the prior art described above, preferred embodiments disclose a method, system, and program for monitoring a device. A determination is made as to a first time, a current time, and a system-up time. The current time follows the first time and the system-up time indicates an elapsed time at the device since the last power cycle. A determination is then made as to whether the current time minus the first time is greater than the system-up time to determine whether the device has started a new power cycle since the first time.
In further embodiments, the device is capable of receiving and processing tasks. The first time indicates a time when the task was sent to the device and determining the system-up time comprises querying the device to determine the system-up time. For instance, the device being polled may be a printer, and the device, such as a computer, performing the polling, may use the SNMP protocol to communicate with the printer.
In further embodiments, the device maintains information on tasks the device is processing. The device is polled to obtain information on a polled task previously sent to the device and a response from the device is received in response to the polling. An indication is made, such as by setting a flag, that the device includes information on the polled task after determining that the response indicates that the device includes information on the polled task. Another polling operation on the polled task is performed after determining that the response indicates that the device includes information on the polled task.
Preferred embodiments provide a mechanism for determining whether a power failure, i.e., initiation of a new power cycle, has occurred since the last time the device was monitored. In this way, if the device did not include information on the task previously sent and a determination is made that a power failure occurred, then an assumption can be made that the device does not include information on the task as a result of the power failure. If a determination is made that a power failure did not occur at the device, then the absence of information on a previously sent task would indicate that either the device has not yet recorded information on the previously sent task or that the task has completed and information thereon has been removed. In referred embodiments, the system monitoring the device may have set a flag in a previous polling operation indicating that the device had information on the task. If in the subsequent poll, no power failure was determined and the flag was set, then it can be assumed that the device completed processing the task and removed information on the completed task.
With the preferred embodiments, a system monitoring the device can determine the reason for the absence of information on a task sent to the device from the device and take appropriate action based on such determination.